﻿using System.Collections.Generic;
using Gumini.JulaDB.DataTypes;

namespace Gumini.JulaDB.Expressions
{
    /// <summary>
    /// Represents a leaf in the expression tree with a null value.
    /// Null has no type.
    /// </summary>
    internal class Null : Expression
    {
        public override TypedValue Evaluate(List<Context<TypedValue>> context)
        {
            return TypedValue.Null;
        }

        public override DataType InferType(Context<DataType> context)
        {
            // null has no data type
            return null;
        }

        public override bool Equals(Expression other)
        {
            var b = other as Null;
            return (b != null);
        }

        public override string ToString()
        {
            return "null";
        }
    }
}
